<div class="asidetop">
    <ul class="tab_navs">
        <li >
            <a onclick="getRight('/Sucai/single');"  href="javascript:void(0)">添加单图文消息</a>
        </li>
        <li >
            <a onclick="getRight('/Sucai/double');" href="javascript:void(0)">添加多图文消息</a>
        </li>
        <li class="selected">
            <a onclick="getRight('/Sucai/text');" href="javascript:void(0)">添加文本消息</a>
        </li>
        <li>
            <a onclick="getRight('/Sucai/image');" href="javascript:void(0)">添加图片消息</a>
        </li>

    </ul>
</div>
<div style="padding:30px 20px 0">





    <div class="media_edit_area">

        <label class="frm_label">
            <strong class="title">文本信息：</strong>
        </label>
        <br />
        <script id="editor" type="text/plain" name="content" style="width:600px;height:60px;"></script>
        <br />
        <label class="frm_label">
            <strong class="title">关键字：</strong><input type="text" id="keyword"/>
        </label>
        <br/>

        <div class="tool_bar tc">
            <button class="btn btn_primary" id="submit_form" href="javascript:void(0);" >保存</button>
        </div>
    </div>
    <br />
    <hr />

    <div class="media_edit_area" style="float:left;">
        <table border="1px solid grey" style="width:700px;">
            <tr>
                <th>编号</th>
                <th>文本</th>
                <th>关键字</th>
                
            </tr>
            <volist name="data" id="vo">
            <tr>
                <td>{$vo.id}</th>
                <th>{$vo.content}</th>
                <th><input type="text" value="{$vo.kw}" style="background: #ccc" class="kw" name="{$vo.id}"/></th>
                
            </tr>
            </volist>
            
        </table>
    </div>



</div>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/js/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    
   var ue = UE.getEditor('editor');

   
   
 $("#submit_form").click(function(){
    var content = ue.getContent();
       var kw = $("#keyword").val();
       
       if(kw ==""){
           alert("关键字不能为空！");
       }else{
           $.post("/Sucai/add_text",{content:content,type:'text',word:kw},function(data){
               getRight('/Sucai/text');
           })
       }
 }); 
 
 $(".kw").focus(function(){
    
        $(this).css("background","white");
 
 });
 
 $(".kw").blur(function(){
    
        $(this).css("background","#ccc");
 
 });
 
 $(".kw").change(function(){
 
        var id =$(this).attr("name");
        
        var kw = $(this).val();
        
        $.post("/Keyword/updateKW",{word:kw,sid:id,type:'text'},function(){
            
            
        })
        
        
 });
 
 
   
});

</script>
